var mm_restaurant = {

		/**
		 * 
		 */
		getRestaurants: function(thisParent,callback) {
			
			var offset = $('div.restaurant_cell').length;
			
			var foundTotal = 0;
			
			if ($('#find_a_restaurant_str').get(0)) {
				var query = $('#find_a_restaurant_str').val();
			} else {
				if ($('#location').get(0)) {
					var query = $('#location').val();
				}
			}
				
				
			
			$.ajax({
			   		type: "POST",
			   		url: "/restaurant/findforxml/format/xml",
			   		data: {
			   			'submit': true,
			   			'offset': offset,
			   			'offers': false,
			   			'color': 'pink',
			   			'section': 'restaurants',
			   			'q': query	
			   		},
			   		dataType: "xml",
				 	
			   		success:function( data ) {
			   			
			   			var foundTotal = $(data).find('restaurant').length;
			   			
			   			if (foundTotal > 0) {
			   			
				   			$('.more_restaurants').remove();
				   			xslpath = '/assets/xsl/view/restaurants.xsl';
				   			var transform	=	mm_xslt.serveXslt(data, xslpath);
				   			thisParent.append(transform);
				   			
				   			$('.load_restaurants').attr('id', 'get_restaurants');
				   			$('.more_restaurants').attr('id', 'append_get_restaurants');
			   			
				   			if(foundTotal < 3) {
				   				$('.more_restaurants').remove();
				   			}
				   			$('.load_restaurants').css('display','none');
				   			$('.load_restaurants').customFadeIn('fast');
				   			
			   			
			   			} else {			   				
			   				$(data).find('error').each(function(){			   					
			   					//$('#restaurant_info').append('<div class="error">' + $(this).text() + '</div>');
			   					alert($(this).text());
			   				});
			   			}
			   			if (callback && typeof(callback) === "function") {
							callback(foundTotal);
						}
			   		
			   		},
				   
			   		error: function() {
				
			   		}
			});
			
			

			
		}
}
